<?php
/**
 * Education Level Administration Grid
 * 
 * @author Xavier VILAIN
 * @package Hive\Education
 * @license #license-hive#
 * 
 */
use Fox\Generator;
use Fox\Dao\SqlFragment;
$xview = Xview::instance();
// Customizing
$customizing = Hive\Admin\Customizing::instance();
$customizing->trackSummaryPage(array('mod' =>'education','act'=>'levels','sac'=>null));

if(!Fox\Authorization\Manager::check(Hive\Authorizations::EDUCATION_LEVEL_R)) {
	echo $xview->accessDenied(Msg(Hive::BUNDLE,Hive::ERR_ADMIN_ACCES_DENIED),null,true);
	exit;
}

$reload = $xview->val('reload',false);
$screen = new Fox\Html\Screen('sLevels');
$screen->pageTitle(Msg(Hive::BUNDLE,Hive::MENU_EDUCATION_LEVEL));
$bAction = new Fox\Html\Button('add','?',Msg(Hive::BUNDLE,Hive::EDUCATION_LEVEL_ADD_NEW));
$bAction->color(Fox\Html\Button::COLOR_WARNING)
		->behaviors(Fox\Behaviors::action(
			Fox\Generator::url('education','levels','modify'),
			true
		));	
$screen->message('<p class="prettyprint">'.$bAction->display().Msg(Hive::BUNDLE,Hive::YOU_WILL_FIND_BELLOW_THE_LIST_OF_DIPLOMA).'</p>');

$data = Hive\Education\Level::loadAll();
			
$grid = new Fox\Grid('gLevels',Generator::url('education','levels'));
$grid->bootstrapGrid()->fieldcat(array('label','standard','active','iedit'));
$grid->fieldcat()->switchToObjectMode();
$grid->fieldcat()->setGenerators(array(
	'iedit' => '?',
	'label' => Generator::call('label')
));
$grid->fieldcat()->field('iedit')->renderer()
		->behaviors(Fox\Behaviors::action(
			Generator::url('education','levels','modify',array('inlineid' => Generator::call('GetInLineId'))),
			true
		));
	
$grid->initialize($data);
$screen->add($grid);
return '<div class="source {\'uri\':\'?mod=education&act=levels\'}" >'.$screen->display().'</div>';